package com.mall.service.impl;

import com.mall.dao.IPermissionDao;
import com.mall.domain.Permission;
import com.mall.service.IPermissionService;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 权限的业务层实现类
 * @author : liangY
 * @date : 2020-12-29 0:36
 */
@Service("permissionService")
public class PermissionServiceImpl implements IPermissionService {

    @Autowired
    private IPermissionDao permissionDao;

    /**
     * 查询权限父节点
     * @return
     */
    @Override
    public List<Permission> getTree() {
        return permissionDao.getTree();
    }

    /**
     * 查询权限子节点
     * @param parentId
     * @return
     */
    @Override
    public List<Permission> listChild(int parentId) {
        return permissionDao.listChild(parentId);
    }

    /**
     * 查询权限集合
     * @return
     */
    @Override
    public List<Permission> getList(){
        return permissionDao.getList();
    }

    /**
     * 查询指定角色
     * @return
     */
    @Override
    public List<Permission> getTree2(Integer role_id) {
        return permissionDao.getTree2(role_id);
    }
}
